package com.guslegend.exception;

import com.guslegend.enums.BizCodeEnum;
import lombok.Data;

/**
 * @author: guslegend
 * @description: 自定义异常
 * @create: 2025-05-25 08:27
 **/
@Data
public class BizException extends RuntimeException {
    private int code;
    private String message;

    public BizException(int code, String message) {
        super(message);
        this.code = code;
        this.message = message;
    }

    public BizException(BizCodeEnum bizCodeEnum) {
        super(bizCodeEnum.getMessage());
        this.code = bizCodeEnum.getCode();
        this.message = bizCodeEnum.getMessage();
    }
}

